home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 410 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com(Pete)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Faster FILE subroutines in standard C?
  5. Date: 4 Jan 1996 11:49:20 GMT
  6. Organization: Pipeline USA
  7. Message-ID: <4cges0$kqi@news1.usa.pipeline.com>
  8. References: <4cflbt$d4h@sunburst.ccs.yorku.ca>
  9. NNTP-Posting-Host: pipe8.h1.usa.pipeline.com
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete)
  13. X-Newsreader: Pipeline USA v3.3.0
  14.  
  15. On Jan 04, 1996 04:34:05 in article <Re: Faster FILE subroutines in
  16. standard C?>, 'ken@yorku.ca (Kenneth Kafieh)' wrote: 
  17.  
  18. >Ken (ken@afep.yorku.ca) wrote: 
  19. >: I found that I was able to get 3-4 time faster performance by using good
  20.  
  21. >: old ANSI C file accessing routines (like  fgets, fseek, ftell, ...etc.) 
  22. >: instead of C++ streams (like ifstream::getline, fstream::seekg, ...etc.)
  23.  
  24. >: I wrote the program originally in C++ (a simple little phonebook for my 
  25. >: own use) and it took about 9 seconds to scan a 100Kb file for a 3 byte 
  26. >: string!!!  Fed up, I rewrote it in C and voila! Now it takes 2 secs! 
  27. >: I'm using Borland C++ v2.0. 
  28. >: Does that sound right?   
  29.  
  30. No. 
  31.  
  32. >:                         Maybe my code was inefficiently written? 
  33.  
  34. That would be my guess -- given the difference. 
  35.  
  36. >: I know C++ is generally slower than C but I didn't think that  
  37.  
  38. Why do you say that?  
  39.  
  40. >: file stuff would be too.   What did I do wrong? Am I missing 
  41. >: something.  Maybe I'll post the code too, later. Has anyone 
  42. >: else noticed this too? 
  43. I wouldn't place too much value in the results of an old  
  44. implementation of a library.  BC20 was released about five years 
  45. ago so its performace is really not applicable today.  
  46.  
  47. I haven't performed actual tests; however, with today's compiler 
  48. systems there is a negligible apparent difference (if any) 
  49. between stdio and iostreams -- at least in the applications 
  50. I've converted from one to the other. 
  51.  
  52. -- 
  53.  
  54. Pete
  55.